package com.moyu.user.utils;

import lombok.Data;
import org.springframework.context.annotation.Configuration;

import java.util.Random;

/**
 * 生成六位随机邮箱验证码
 *
 * @Author 赵彦博
 * @Date 2025/3/25 23:19
 */
@Data
@Configuration
public class EmailCodeUtil {

    public String emailCode;

    public void init() {
        StringBuilder stringBuilder = new StringBuilder();
        Random random = new Random();
        while (stringBuilder.length() < 6){
            int c = random.nextInt(10);
            stringBuilder.append(c);
        }
        emailCode = stringBuilder.toString();
    }

}
